package com.ibeifeng.crm.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.stereotype.Repository;

import com.ibeifeng.crm.bean.Log;
import com.ibeifeng.crm.dao.GetLogDao;

@Repository
public class GetLogDaoImpl implements GetLogDao {
	@Resource
	SqlSessionFactory factory;
	Map map = new HashMap();
	@Override
	public List<Log> queryLimit(int pg, int pgSize,String keyWord) {
		int start=(pg-1)*pgSize;
		map.put("start", start);
		map.put("pageSize", pgSize);
		map.put("keyWord", keyWord);
		List<Log> list =factory.openSession().selectList("com.ibeifeng.crm.log.bean.mapping.LogNS.queryLimit",map);
		return list;
	}
	@Override
	public int count() {
		int i = factory.openSession().selectOne("com.ibeifeng.crm.log.bean.mapping.LogNS.queryCount",map);
		return i;
	}
}
